{extend name="public/base" /} {block name="body"}
<div class="content-tabs">
	<ol class="breadcrumb">
		<li>
			<a href="{:url('index/index')}"><i class="fa fa-home"></i></a>
		</li>
		{if $type==1}
		<li>
			<a href="{:url('storage')}">入库管理</a>
		</li>
		<li>
			<strong>制作入库单</strong>
		</li>
		{elseif $type==2}
		<li>
			<a href="{:url('placing')}">出库管理</a>
		</li>
		<li>
			<strong>制作出库单</strong>
		</li>
		{/if}
	</ol>
</div>
<link rel="shortcut icon" href="favicon.ico">
<link href="__CSS__/bootstrap.min.css" rel="stylesheet">
<link href="__CSS__/font-awesome.min.css" rel="stylesheet">
<link href="__CSS__/animate.min.css" rel="stylesheet">
<link href="__CSS__/style.min.css" rel="stylesheet">
<link href="__CSS__/admin.css" rel="stylesheet">
<div class="ibox float-e-margins">
	<div class="ibox-content">
		<form id="myForm" class="form-horizontal m-t" method="post" action="{:url('savestock')}">
		<div class="form-group" style="padding-left: 20px;">
			单号 <input type="text" id="sn" name="sn" value="{$sn}" class="bank" />
			{if $type==1}
			入库类型 <select  id="stocktype" name="stocktype" class="bank" >
	                <option value="1">采购入库</option>
	                <option value="2">其他入库</option>
	            </select>
	        {elseif $type==2}
	        	出库类型 <select  id="stocktype" name="stocktype" class="bank" >
	                <option value="3">销售出库</option>
	                <option value="4">其他出库</option>
	            </select>
	        {/if}
			日期 <input type="text" id="add_time" name="add_time" value="{$add_time}" class="bank" />
			制单人<input type="text" id="czy" name="czy" value="{$czy}" class="bank" />
		</div>		
		<div class="panel panel-default">
			<div class="panel-heading"> 商品列表</div>
				<div class="panel-body">
				<div class="example-wrap">
				<span onclick="addgoods()"><a>+添加商品</a></span>	
				<table class="table table-bordered table-hover">
					<thead>
						<tr class="long-th">
							<th width="500px">商品名称</th>
							{if $type==1}
							<th>入库数量</th>
							{elseif $type==2}
							<th>出库数量</th>
							{/if}
							<th width="500px">备注</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody id="goodslist" class=" text-center">
					</tbody>
				</table>
				</div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-1 control-label">备注：</label>
			<div class="input-group col-sm-4">
				<textarea id="comments" name="comments" rows="3" style="width: 300px;" placeholder="备注"></textarea>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-1 control-label">经办人：</label>
			<div class="input-group col-sm-4">
				<input type="text" id="jbrname" name="jbrname"  value="" placeholder="经办人" class="form-control" />
			</div>
		</div>
		<div class="form-group">
			<div class="col-sm-4 col-sm-offset-8" style="text-align: right;">	
				<!--<input type="hidden" name="goods_id" di="goods_id" value="{$id}" />-->
				<input type="hidden" name="type" id="type" value="{$type}" />
				<button class="btn btn-info" type="submit"><i class="fa fa-save"></i> 保存</button>&nbsp;&nbsp;
				<a class="btn btn-danger" href="{:url('placing')}"><i class="fa fa-arrow-left"></i> 返回 </a>
			</div>
		</div>
	</br>
	</form>
	</div>
</div>
{/block} {block name="script"}
<script src="__JS__/jquery.min.js"></script>
<script src="__JS__/bootstrap.min.js"></script>
<script src="__JS__/jquery.metisMenu.js"></script>
<script src="__JS__/jquery.slimscroll.min.js"></script>
<script src="__LIB__/layer/layer.js"></script>
<script src="__JS__/core.min.js"></script>
<script src="__JS__/pace.min.js"></script>
<script src="__JS__/jquery.form.js"></script>
<script src="__LIB__/datepicker/WdatePicker.js"></script>
<script src="__LIB__/validate/jquery.validate.min.js"></script>
<script src="__LIB__/validate/messages_zh.min.js"></script>
<script src="__LIB__/validate/add_validate.min.js"></script>
<script src="__LIB__/fileinput/js/fileinput.min.js"></script>
<script src="__LIB__/fileinput/js/locales/zh.js"></script>
<script src="__LIB__/ueditor/ueditor.config.js" type="text/javascript"></script>
<script src="__LIB__/ueditor/ueditor.all.js" type="text/javascript"></script>
<script>
	function wclose(){
    	var index = parent.layer.getFrameIndex(window.name); //获取窗口索引  
        parent.layer.close(index);  
	}
	
	$(function() {
		$("#myForm").validate({
			submitHandler: function(form) {
				ajaxForm();
			}
		});
	});
</script>
<script>  
   	//选择商品
	function addgoods(){
		layer.open({		
	  	type: 2, 
	  	id: "goods_list",
	 	area: ['850px', '450px'] ,
	 	title: '添加商品',
	 	scrollbar: false,
	  	content: '/web/stock/goods_list' //这里content是一个URL，如果你不想让iframe出现滚动条，你还可以content: ['http://sentsin.com', 'no']
		}); 
	}
	
	function del_goods(obj){
		$(obj).parent().parent().remove();
	}
</script>
<style>
.bank{
	width: 150px;
    height:30px;
    text-align:center;
    border-radius:5px;
}
</style>
{/block}